package com.lanou3g.bookstore.util.listener_and_filter;

import com.lanou3g.bookstore.util.util.FatherFilter;

import javax.servlet.DispatcherType;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebFilter(filterName = "OneFilter", urlPatterns = "/*",
        dispatcherTypes = {DispatcherType.REQUEST,
                DispatcherType.FORWARD, DispatcherType.INCLUDE})
public class OneFilter extends FatherFilter {
    @Override
    public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
        request.setCharacterEncoding("utf8");
        response.setContentType("text/html;charset=utf8");
        chain.doFilter(request, response);
    }
}
